import { IsOptional, IsString, IsInt, Min, Max } from "class-validator";
import { Type } from "class-transformer";

/**
 * 菜单查询参数DTO
 */
export class QueryMenuDto {
  @IsOptional()
  @Type(() => Number)
  @IsInt({ message: "页码必须是整数" })
  @Min(1, { message: "页码必须大于0" })
  page?: number;

  @IsOptional()
  @Type(() => Number)
  @IsInt({ message: "每页数量必须是整数" })
  @Min(1, { message: "每页数量必须大于0" })
  @Max(100, { message: "每页数量不能超过100" })
  pageSize?: number;

  @IsOptional()
  @IsString({ message: "菜单名称必须是字符串" })
  name?: string;

  @IsOptional()
  @IsInt({ message: "菜单排序必须是整数" })
  order?: number;

  @IsOptional()
  @IsString({ message: "菜单路径必须是字符串" })
  path?: string;

  @IsOptional()
  @IsString({ message: "访问控制必须是字符串" })
  acl?: string;
}
